<template>
  <div class="app">
    <h1>我是App组件</h1>
    <h3 v-show="toy">儿子很孝顺，给我了一台游戏机：{{toy}}</h3>
    <Person :sendToy="getToy"/>
  </div>
</template>

<script>
  import Person from './components/Person'

  export default {
    name:'App',
    components:{Person},
    data() {
      return {
        toy:''
      }
    },
    methods: {
      getToy(value){
        console.log('我是App组件（父）收到了一个玩具：',value)
        this.toy = value
      }
    },
  }
</script>

<style>
  .app {
    background-color: gray;
    padding: 20px;
  }
</style>